home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / security / Watcher / maxmin_check.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-08-02  |  716 b   |  37 lines

  1. /*
  2.    maxmin_check: verify that the value is between min and max.
  3.  
  4.    Kenneth Ingham
  5.  
  6.    Copyright (C) 1988 The University of New Mexico
  7. */
  8.  
  9. #include "defs.h"
  10. #include "y.tab.h"
  11.  
  12. maxmin_check(current, max, min, cmd, name, line)
  13. char *current;
  14. double max, min;
  15. char *cmd, *name, *line;
  16. {
  17.     extern int line_ok, cmd_ok;
  18.     double value;
  19.  
  20.     value = atof(current);
  21.  
  22.     if (value > max || value < min) {
  23.         if (line_ok) {
  24.             printf("%s has a ", cmd);
  25.             printf("max/min value out of range:\n");
  26.             printf("%s\n",line);
  27.         }
  28.         else {
  29.             printf("Also, it has a ");
  30.             printf("max/min value out of range:\n");
  31.         }
  32.         printf("where %s = %.2f; ", name, value);
  33.         printf("valid range %.2f to %.2f.\n", min, max);
  34.         line_ok = False;
  35.     }
  36. }
  37.